from django.db import models
from pet.models import PetModel


# Create your models here.
# 体重记录表
class WeightModel(models.Model):
    weight = models.FloatField(verbose_name='体重')
    recodetime = models.DateTimeField(verbose_name='记录时间')
    body = models.CharField(max_length=1, choices=(
        ('1', '很瘦'),
        ('2', '偏瘦'),
        ('3', '正常'),
        ('4', '偏胖'),
        ('5', '肥胖')
    ), verbose_name='体型')
    describe = models.CharField(max_length=50, blank=True, null=True, verbose_name='描述')
    pet = models.ForeignKey(PetModel, on_delete=models.CASCADE)

    def __str__(self):
        return f"{self.pet.name}'s weight record"

    class Meta:
        db_table = 'pet_weight'


# 饮食记录表
class DietModel(models.Model):
    food = models.CharField(max_length=50, verbose_name='食物名称')
    foodweight = models.FloatField(verbose_name='喂食重量')
    recodetime = models.DateTimeField(verbose_name='记录时间')
    describe = models.CharField(max_length=50, blank=True, verbose_name='描述', null=True)
    pet = models.ForeignKey(PetModel, on_delete=models.CASCADE)

    def __str__(self):
        return f"{self.pet.name}'s diet record"

    class Meta:
        db_table = 'pet_diet'


# 饮食记录表，分表一
class DietOneModel(models.Model):
    id = models.BigIntegerField(primary_key=True)
    food = models.CharField(max_length=50, verbose_name='食物名称')
    foodweight = models.FloatField(verbose_name='喂食重量')
    recodetime = models.DateTimeField(verbose_name='记录时间')
    describe = models.CharField(max_length=50, blank=True, verbose_name='描述', null=True)
    pet_id = models.IntegerField()

    def __str__(self):
        return f"{PetModel.objects.filter(id=self.pet_id).first().name}'s diet record"

    class Meta:
        db_table = 'pet_diet_one'

# 饮食记录表，分表二
class DietTwoModel(models.Model):
    id = models.BigIntegerField(primary_key=True)
    food = models.CharField(max_length=50, verbose_name='食物名称')
    foodweight = models.FloatField(verbose_name='喂食重量')
    recodetime = models.DateTimeField(verbose_name='记录时间')
    describe = models.CharField(max_length=50, blank=True, verbose_name='描述', null=True)
    pet_id = models.IntegerField()

    def __str__(self):
        return f"{PetModel.objects.filter(id=self.pet_id).first().name}'s diet record"

    class Meta:
        db_table = 'pet_diet_two'

# 饮食记录表，分表三
class DietThreeModel(models.Model):
    id = models.BigIntegerField(primary_key=True)
    food = models.CharField(max_length=50, verbose_name='食物名称')
    foodweight = models.FloatField(verbose_name='喂食重量')
    recodetime = models.DateTimeField(verbose_name='记录时间')
    describe = models.CharField(max_length=50, blank=True, verbose_name='描述', null=True)
    pet_id = models.IntegerField()

    def __str__(self):
        return f"{PetModel.objects.filter(id=self.pet_id).first().name}'s diet record"

    class Meta:
        db_table = 'pet_diet_three'


# 尿便记录表
class PeeModel(models.Model):
    pee = models.CharField(max_length=10, verbose_name='便尿类型', choices=[('1', '小便'), ('2', '大便'), ('3', '尿')])
    recodetime = models.DateTimeField(verbose_name='记录时间')
    describe = models.CharField(max_length=50, blank=True, null=True, verbose_name='描述')
    pet = models.ForeignKey(PetModel, on_delete=models.CASCADE)

    def __str__(self):
        return f"Pee Record for {self.pet}"

    class Meta:
        db_table = 'pet_pee'


# 健康记录表
class HealthModel(models.Model):
    health = models.CharField(max_length=10, verbose_name='健康项目', choices=[('1', '驱虫'), ('2', '打疫苗')])
    recodetime = models.DateTimeField(verbose_name='记录时间')
    describe = models.CharField(max_length=50, blank=True, null=True, verbose_name='描述')
    pet = models.ForeignKey(PetModel, on_delete=models.CASCADE)

    def __str__(self):
        return f"Health Record for {self.pet}"

    class Meta:
        db_table = 'pet_health'


# 洗护记录表
class ClearoutModel(models.Model):
    clearout = models.CharField(max_length=10, verbose_name='清洗项目', choices=[('1', '洗澡'), ('2', '修指甲')])
    recodetime = models.DateTimeField(verbose_name='记录时间')
    describe = models.CharField(max_length=50, blank=True, verbose_name='描述', null=True)
    pet = models.ForeignKey(PetModel, on_delete=models.CASCADE)

    def __str__(self):
        return f"Clearout Record for {self.pet}"

    class Meta:
        db_table = 'pet_clearout'
